home *** CD-ROM | disk | FTP | other *** search
/ Workbench Add-On / Workbench Add-On - Volume 1.iso / Dev / Oberon / source / FPE / FPETpl.mod < prev    next >
Text File  |  1995-06-29  |  9KB  |  379 lines

  1. (***************************************************************************
  2.  
  3.      $RCSfile: FPETpl.mod $
  4.   Description: Defines and implements the IntuiSup template for the main
  5.                FPE window.
  6.  
  7.    Created by: fjc (Frank Copeland)
  8.     $Revision: 1.10 $
  9.       $Author: fjc $
  10.         $Date: 1995/06/04 22:44:18 $
  11.  
  12.   Copyright © 1993-1994, Frank Copeland.
  13.   This file is part of FPE.
  14.   See FPE.doc for conditions of use and distribution.
  15.  
  16.   Log entries are at the end of the file.
  17.  
  18. ***************************************************************************)
  19.  
  20. <* MAIN- *> <*$ NilChk- *>
  21.  
  22. MODULE FPETpl;
  23.  
  24. IMPORT
  25.   SYS := SYSTEM, Kernel, e := Exec, i := Intuition, is := IntuiSup, Data;
  26.  
  27. (*------------------------------------*)
  28. (* Project Information *)
  29.  
  30. CONST
  31.  
  32.   LeftEdge * = 0;
  33.   TopEdge *  = 0;
  34.   Width *    = 438;
  35.  
  36. VAR
  37.   Height *   : INTEGER;
  38.  
  39. CONST
  40.   RenderInfoFlags * = {};
  41.   OpenWindowFlags * = {is.owCenterScreen};
  42.   WindowFlags * =
  43.     i.smartRefresh +
  44.     (*i.simpleRefresh +*)
  45.     { i.windowDrag .. i.windowClose, i.activate, i.noCareRefresh };
  46.   GadgetIDCMPFlags * = is.giButton + is.giCheck + is.giListview;
  47.  
  48. (*------------------------------------*)
  49. (* Gadget data *)
  50.  
  51. CONST
  52.  
  53.   NumGadgetDatas * = 17;
  54.  
  55. TYPE
  56.  
  57.   GadgetDataPtr * = POINTER TO GadgetData;
  58.  
  59.   GadgetData * = RECORD
  60.     g0 *  : is.ListViewData;
  61.     g1 *  : ARRAY Data.NumFiles OF is.CheckData;
  62.     g2 *  : ARRAY Data.NumTools OF is.ButtonData;
  63.     dataEnd : LONGINT;
  64.   END; (* GadgetData *)
  65.  
  66. (*------------------------------------*)
  67. (* Text data *)
  68.  
  69. CONST
  70.  
  71.   NumTextDatas * = 10;
  72.  
  73. (*------------------------------------*)
  74. (* Border data *)
  75.  
  76. CONST
  77.  
  78.   NumBorderDatas * = 1;
  79.  
  80. (*------------------------------------*)
  81. (* Template data structure *)
  82.  
  83. TYPE
  84.  
  85.   Template * = RECORD
  86.     GadgetData * : GadgetDataPtr;
  87.     TextData *   : is.TextDataListPtr;
  88.     BorderData * : is.BorderDataListPtr;
  89.   END; (* Template *)
  90.  
  91. (*------------------------------------*)
  92. PROCEDURE TextHeight () : INTEGER;
  93.  
  94.   VAR scr : i.Screen;
  95.  
  96. BEGIN (* TextHeight *)
  97.   IF i.GetScreenData (scr, SIZE (i.Screen), {i.wbenchScreen}, NIL) THEN
  98.     RETURN scr.font.ySize
  99.   ELSE
  100.     RETURN 9
  101.   END
  102. END TextHeight;
  103.  
  104. (*------------------------------------*)
  105. (* Gadget data *)
  106.  
  107. (*------------------------------------*)
  108. PROCEDURE InitGadgetData (gd : GadgetDataPtr);
  109.  
  110.   VAR textHeight : INTEGER;
  111.  
  112. BEGIN (* InitGadgetData *)
  113.   ASSERT (gd # NIL, 97);
  114.   textHeight := TextHeight();
  115.  
  116.   gd.g0.type := is.listView;
  117.   gd.g0.flags := {is.gdListviewShowSelected};
  118.   gd.g0.leftEdge := 13;
  119.   gd.g0.topEdge := (3 * textHeight) + 19;
  120.   gd.g0.width := 169;
  121.   gd.g0.height := (5 * textHeight) + 4;
  122.  
  123.   gd.g1[0].type := is.check;
  124.   gd.g1[0].flags := {is.gdTextRight};
  125.   gd.g1[0].leftEdge := 13;
  126.   gd.g1[0].topEdge := (9 * textHeight) + 32;
  127.   gd.g1[0].width := 27;
  128.   gd.g1[0].height := textHeight + 3;
  129.  
  130.   gd.g1[1].type := is.check;
  131.   gd.g1[1].flags := {is.gdTextRight};
  132.   gd.g1[1].leftEdge := 100;
  133.   gd.g1[1].topEdge := (9 * textHeight) + 32;
  134.   gd.g1[1].width := 27;
  135.   gd.g1[1].height := textHeight + 3;
  136.  
  137.   gd.g1[2].type := is.check;
  138.   gd.g1[2].flags := {is.gdTextRight};
  139.   gd.g1[2].leftEdge := 13;
  140.   gd.g1[2].topEdge := (10 * textHeight) + 40;
  141.   gd.g1[2].width := 27;
  142.   gd.g1[2].height := textHeight + 3;
  143.  
  144.   gd.g1[3].type := is.check;
  145.   gd.g1[3].flags := {is.gdTextRight};
  146.   gd.g1[3].leftEdge := 100;
  147.   gd.g1[3].topEdge := (10 * textHeight) + 40;
  148.   gd.g1[3].width := 27;
  149.   gd.g1[3].height := textHeight + 3;
  150.  
  151.   gd.g2[0].type := is.button;
  152.   gd.g2[0].leftEdge := 189;
  153.   gd.g2[0].topEdge := (3 * textHeight) + 19;
  154.   gd.g2[0].width := 113;
  155.   gd.g2[0].height := textHeight + 6;
  156.  
  157.   gd.g2[1].type := is.button;
  158.   gd.g2[1].leftEdge := 312;
  159.   gd.g2[1].topEdge := (3 * textHeight) + 19;
  160.   gd.g2[1].width := 113;
  161.   gd.g2[1].height := textHeight + 6;
  162.  
  163.   gd.g2[2].type := is.button;
  164.   gd.g2[2].leftEdge := 189;
  165.   gd.g2[2].topEdge := (4 * textHeight) + 26;
  166.   gd.g2[2].width := 113;
  167.   gd.g2[2].height := textHeight + 6;
  168.  
  169.   gd.g2[3].type := is.button;
  170.   gd.g2[3].leftEdge := 312;
  171.   gd.g2[3].topEdge := (4 * textHeight) + 26;
  172.   gd.g2[3].width := 113;
  173.   gd.g2[3].height := textHeight + 6;
  174.  
  175.   gd.g2[4].type := is.button;
  176.   gd.g2[4].leftEdge := 189;
  177.   gd.g2[4].topEdge := (5 * textHeight) + 33;
  178.   gd.g2[4].width := 113;
  179.   gd.g2[4].height := textHeight + 6;
  180.  
  181.   gd.g2[5].type := is.button;
  182.   gd.g2[5].leftEdge := 312;
  183.   gd.g2[5].topEdge := (5 * textHeight) + 33;
  184.   gd.g2[5].width := 113;
  185.   gd.g2[5].height := textHeight + 6;
  186.  
  187.   gd.g2[6].type := is.button;
  188.   gd.g2[6].leftEdge := 189;
  189.   gd.g2[6].topEdge := (6 * textHeight) + 40;
  190.   gd.g2[6].width := 113;
  191.   gd.g2[6].height := textHeight + 6;
  192.  
  193.   gd.g2[7].type := is.button;
  194.   gd.g2[7].leftEdge := 312;
  195.   gd.g2[7].topEdge := (6 * textHeight) + 40;
  196.   gd.g2[7].width := 113;
  197.   gd.g2[7].height := textHeight + 6;
  198.  
  199.   gd.g2[8].type := is.button;
  200.   gd.g2[8].leftEdge := 189;
  201.   gd.g2[8].topEdge := (7 * textHeight) + 47;
  202.   gd.g2[8].width := 113;
  203.   gd.g2[8].height := textHeight + 6;
  204.  
  205.   gd.g2[9].type := is.button;
  206.   gd.g2[9].leftEdge := 312;
  207.   gd.g2[9].topEdge := (7 * textHeight) + 47;
  208.   gd.g2[9].width := 113;
  209.   gd.g2[9].height := textHeight + 6;
  210.  
  211.   gd.g2[10].type := is.button;
  212.   gd.g2[10].leftEdge := 189;
  213.   gd.g2[10].topEdge := (8 * textHeight) + 54;
  214.   gd.g2[10].width := 113;
  215.   gd.g2[10].height := textHeight + 6;
  216.  
  217.   gd.g2[11].type := is.button;
  218.   gd.g2[11].leftEdge := 312;
  219.   gd.g2[11].topEdge := (8 * textHeight) + 54;
  220.   gd.g2[11].width := 113;
  221.   gd.g2[11].height := textHeight + 6;
  222.  
  223.   gd.dataEnd := is.dataEnd;
  224. END InitGadgetData;
  225.  
  226. (*------------------------------------*)
  227. (* Text data *)
  228.  
  229. (*------------------------------------*)
  230. PROCEDURE InitTextData (td : is.TextDataListPtr);
  231.  
  232.   VAR textHeight : INTEGER;
  233.  
  234. <*$ < IndexChk- *>
  235. BEGIN (* InitTextData *)
  236.   ASSERT (td # NIL, 97);
  237.   textHeight := TextHeight();
  238.  
  239.   td[0].type := is.text;
  240.   td[0].leftEdge := 15;
  241.   td[0].topEdge := textHeight + 10;
  242.   td[0].text := SYS.ADR("Project");
  243.  
  244.   td[1].type := is.text;
  245.   td[1].flags := {is.tdBackFill};
  246.   td[1].leftEdge := 95;
  247.   td[1].topEdge := textHeight + 9;
  248.  
  249.   td[2].type := is.text;
  250.   td[2].leftEdge := 65;
  251.   td[2].topEdge := (2 * textHeight) + 16;
  252.   td[2].text := SYS.ADR("Modules");
  253.  
  254.   td[3].type := is.text;
  255.   td[3].leftEdge := 281;
  256.   td[3].topEdge := (2 * textHeight) + 16;
  257.   td[3].text := SYS.ADR("Tools");
  258.  
  259.   td[4].type := is.text;
  260.   td[4].leftEdge := 73;
  261.   td[4].topEdge := (8 * textHeight) + 29;
  262.   td[4].text := SYS.ADR("Files");
  263.  
  264.   td[5].type := is.text;
  265.   td[5].flags := {is.tdColor2};
  266.   td[5].leftEdge := 13;
  267.   td[5].topEdge := textHeight + 9;
  268.   td[5].text := SYS.ADR("Project");
  269.  
  270.   td[6].type := is.text;
  271.   td[6].flags := {is.tdColor2};
  272.   td[6].leftEdge := 63;
  273.   td[6].topEdge := (2 * textHeight) + 15;
  274.   td[6].text := SYS.ADR("Modules");
  275.  
  276.   td[7].type := is.text;
  277.   td[7].flags := {is.tdColor2};
  278.   td[7].leftEdge := 279;
  279.   td[7].topEdge := (2 * textHeight) + 15;
  280.   td[7].text := SYS.ADR("Tools");
  281.  
  282.   td[8].type := is.text;
  283.   td[8].flags := {is.tdColor2};
  284.   td[8].leftEdge := 71;
  285.   td[8].topEdge := (8 * textHeight) + 28;
  286.   td[8].text := SYS.ADR("Files");
  287.  
  288.   td[9].type := is.dataEnd;
  289. END InitTextData;
  290. (*$ > *)
  291.  
  292. (*------------------------------------*)
  293. (* Border data *)
  294.  
  295. (*------------------------------------*)
  296. PROCEDURE InitBorderData (bd : is.BorderDataListPtr);
  297.  
  298.   VAR textHeight : INTEGER;
  299.  
  300. <*$ < IndexChk- *>
  301. BEGIN (* InitBorderData *)
  302.   ASSERT (bd # NIL, 97);
  303.   textHeight := TextHeight();
  304.  
  305.   bd[0].type := is.box1In;
  306.   bd[0].leftEdge := 90;
  307.   bd[0].topEdge := textHeight + 7;
  308.   bd[0].width := 334;
  309.   bd[0].height := textHeight + 4;
  310.  
  311.   bd[1].type := is.dataEnd;
  312. END InitBorderData;
  313. (*$ > *)
  314.  
  315. (*------------------------------------*)
  316. PROCEDURE Init * (VAR template : Template);
  317.  
  318. BEGIN (* Init *)
  319.   Height := (11 * TextHeight()) + 50;
  320.   NEW (template.GadgetData);
  321.   InitGadgetData (template.GadgetData);
  322.   Kernel.Allocate
  323.     ( template.TextData,
  324.       SIZE (is.TextData) * NumTextDatas + 4,
  325.       {e.memClear} );
  326.   InitTextData (template.TextData);
  327.   Kernel.Allocate
  328.     ( template.BorderData,
  329.       SIZE (is.BorderData) * NumBorderDatas + 4,
  330.       {e.memClear} );
  331.   InitBorderData (template.BorderData)
  332. END Init;
  333.  
  334. (*------------------------------------*)
  335. PROCEDURE Cleanup * (VAR template : Template);
  336.  
  337. BEGIN (* Cleanup *)
  338.   SYS.DISPOSE (template.GadgetData);
  339.   SYS.DISPOSE (template.TextData);
  340.   SYS.DISPOSE (template.BorderData);
  341. END Cleanup;
  342.  
  343. END FPETpl.
  344.  
  345. (***************************************************************************
  346.  
  347.   $Log: FPETpl.mod $
  348.   Revision 1.10  1995/06/04  22:44:18  fjc
  349.   - Changed text colours.
  350.  
  351.   Revision 1.9  1995/01/26  00:15:33  fjc
  352.   - Release 1.5
  353.  
  354.   Revision 1.8  1994/09/25  18:20:54  fjc
  355.   - Uses new syntax for external code declarations
  356.  
  357.   Revision 1.7  1994/08/08  16:14:33  fjc
  358.   Release 1.4
  359.  
  360.   Revision 1.6  1994/06/17  17:26:27  fjc
  361.   - Updated for release
  362.  
  363.   Revision 1.5  1994/06/09  13:38:52  fjc
  364.   - Incorporated changes in Amiga interface.
  365.  
  366.   Revision 1.4  1994/06/04  23:49:52  fjc
  367.   - Changed to use new Amiga interface
  368.  
  369.   Revision 1.3  1994/05/12  21:26:09  fjc
  370.   - Prepared for release
  371.  
  372.   Revision 1.2  1994/01/24  14:33:33  fjc
  373.   Changed version control header
  374.  
  375.   Revision 1.1  1994/01/15  17:32:38  fjc
  376.   Start of revision control
  377.  
  378. ***************************************************************************)
  379.